from sqlalchemy import Column, String, Text, text,Integer
from sqlalchemy.dialects import mysql

from .base import Base

__all__ = [
    'medical_page',
    'MedicalPage',
    'SwiperData',
    'swiper_page',
     'RecommendData',
    'recommend_page'
]


class MedicalMenu(Base):
    """
    医保页面表
    """
    __tablename__ = 'la_medical_page'
    __table_args__ = {
        'mysql_engine': 'InnoDB',
        'mysql_charset': 'utf8mb4',
        'mysql_collate': 'utf8mb4_general_ci',
        'mysql_row_format': 'Dynamic',
        'mysql_auto_increment': '1',
        'comment': '医保页面表',
    }
    id = Column(mysql.INTEGER(10, unsigned=True), primary_key=True, comment='主键')
    name = Column(String(20), nullable=False, server_default='', comment='名称')
    title = Column(String(200), nullable=False, server_default='', comment='标题')
    path = Column(String(200), nullable=False, server_default='', comment='页面路由')
    is_show = Column(Integer, nullable=False, server_default='0', comment='是否显示')
    create_time = Column(mysql.INTEGER(10, unsigned=True), nullable=False, server_default=text('0'), comment='创建时间')
    update_time = Column(mysql.INTEGER(10, unsigned=True), nullable=False, server_default=text('0'), comment='更新时间')

class SwiperData(Base):
    """
    轮播图表
    """
    __tablename__ = 'la_swiper'
    __table_args__ = {
        'mysql_engine': 'InnoDB',
        'mysql_charset': 'utf8mb4',
        'mysql_collate': 'utf8mb4_general_ci',
        'mysql_row_format': 'Dynamic',
        'mysql_auto_increment': '1',
        'comment': '轮播图表',
    }
    id = Column(mysql.INTEGER(10, unsigned=True), primary_key=True, comment='主键')
    title = Column(String(200), nullable=False, server_default='', comment='标题')
    image = Column(String(200), nullable=False, server_default='', comment='图片地址')
    pagepath = Column(String(200), nullable=False, server_default='', comment='页面路由')
    is_show = Column(Integer, nullable=False, server_default='0', comment='是否显示')
    create_time = Column(mysql.INTEGER(10, unsigned=True), nullable=False, server_default=text('0'), comment='创建时间')
    update_time = Column(mysql.INTEGER(10, unsigned=True), nullable=False, server_default=text('0'), comment='更新时间')

class RecommendData(Base):
    """
    精选推荐表
    """
    __tablename__ = 'la_recommend'
    __table_args__ = {
        'mysql_engine': 'InnoDB',
        'mysql_charset': 'utf8mb4',
        'mysql_collate': 'utf8mb4_general_ci',
        'mysql_row_format': 'Dynamic',
        'mysql_auto_increment': '1',
        'comment': '轮播图表',
    }
    id = Column(mysql.INTEGER(10, unsigned=True), primary_key=True, comment='主键')
    title = Column(String(200), nullable=False, server_default='', comment='标题')
    image = Column(String(200), nullable=False, server_default='', comment='图片地址')
    content = Column(Text, nullable=False, server_default='', comment='内容')
    is_show = Column(Integer, nullable=False, server_default='0', comment='是否显示')
    create_time = Column(mysql.INTEGER(10, unsigned=True), nullable=False, server_default=text('0'), comment='创建时间')
    update_time = Column(mysql.INTEGER(10, unsigned=True), nullable=False, server_default=text('0'), comment='更新时间')
medical_page = MedicalMenu.__table__
swiper_page = SwiperData.__table__
recommend_page = RecommendData.__table__
